/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tuitionmanagement.entity;
import java.io.Serializable;
import java.util.regex.Matcher;
import java.util.regex.Pattern;



/**
 *
 * @author lab
 */
public class Account implements Serializable {

    private int AccountId;
    private int RoleId;
    
    private String Username;
    private String Password;    
     private String LastError;

    public Account() {
    }

    public Account(int _AccountId, int _RoleId, String _Username, String _Password) {
        this.AccountId = -_AccountId;
        this.RoleId = _RoleId;
        
        
        this.Password = _Password;
        this.Username = _Username;

    }
        public boolean validate() {
        Pattern p = Pattern.compile("(\\w){5,30}");
        Matcher m = p.matcher(getPassword());
        if (m.find()) {
            return true;
        }
        setLastError("Password length must between 5 and 30 !");
        return false;
    }

    /**
     * @return the AccountId
     */
    public int getAccountId() {
        return AccountId;
    }

    /**
     * @param AccountId the AccountId to set
     */
    public void setAccountId(int AccountId) {
        this.AccountId = AccountId;
    }

    /**
     * @return the RoleId
     */
    public int getRoleId() {
        return RoleId;
    }

    /**
     * @param RoleId the RoleId to set
     */
    public void setRoleId(int RoleId) {
        this.RoleId = RoleId;
    }

   
    /**
     * @return the Username
     */
    public String getUsername() {
        return Username;
    }

    /**
     * @param Username the Username to set
     */
    public void setUsername(String Username) {
        this.Username = Username;
    }

    /**
     * @return the Password
     */
    public String getPassword() {
        return Password;
    }

    /**
     * @param Password the Password to set
     */
    public void setPassword(String Password) {
        this.Password = Password;
    }

   
    /**
     * @return the LastError
     */
    public String getLastError() {
        return LastError;
    }

    /**
     * @param LastError the LastError to set
     */
    public void setLastError(String LastError) {
        this.LastError = LastError;
    }
}
